<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
  <!ENTITY copy "&#169;">
  <!ENTITY nbsp "&#160;">
  <!ENTITY laquo "&#171;">
  <!ENTITY raquo "&#187;">
]>
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">
    

<xsl:template match="/">
	<xsl:apply-templates />
</xsl:template>

<xsl:template name="Photos">
  <xsl:param name="arts"/>
  <xsl:param name="files"/>
    <script type="text/javascript" src="/js/listing.js"></script>
    <script type="text/javascript" src="/js/dragsort/jquery.dragsort.js"></script>
    <script type="text/javascript" src="/js/dragsort/config.js"></script>

    <!--<link href="/js/swfupload/default.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="/js/swfupload/swfupload.js"></script>
    <script type="text/javascript" src="/js/swfupload/handlers.js"></script>
    <script type="text/javascript" src="/js/swfupload/handlers_photo_list.js"></script>
    <script type="text/javascript" src="/js/swfupload/config.js"></script>-->


    <link rel="stylesheet" type="text/css" href="/js/upload/jquery.prsfileupload.css" />
    <script src="/js/upload/vendor/jquery.ui.widget.js"></script>
    <script src="/js/upload/jquery.iframe-transport.js"></script>
    <script src="/js/upload/jquery.fileupload.js"></script>
    <script src="/js/upload/jquery.prsfileupload.js"></script>
    <script src="/js/upload/upload_xml_config.js"></script>


    <input type="hidden" id="controller" value="{$Controller}"/>
    <input type="hidden" id="table_name" value="{$Main/@table_name}"/>
    <input type="hidden" id="upload_url" value="/{$Controller}/upload-photos/id/{$Main/@id}/f/{$Content/@table_field}"/>

    <div class="contenthead">

      <xsl:call-template name="Create_Path"/>
      <div class="top">
        <span class="title">
          <xsl:value-of select="$Cats/row[id=$Content/@cat]/title" />
        </span>

      </div>
    </div>

    <form action="" id="form" method="post">
      <div class="aside">
        <div class="head-slide on">
          Добавить фотографии
        </div>
        <div class="container">
          <div class="photo-add">
            <ul class="editlist">
              <li>
                <label>Флеш-загрузка</label>
                <input name="button_add_flash" value="Добавить несколько фотографий" type="button" onclick="return html_show();"/>
              </li>
              <li>
                <label>Стандартное добавление</label>
                <input name="button_add" id="button_add" value="Добавить фотографию" type="button" onclick="javascript:window.location = '/{$Controller}/addphoto/{$Main/@id}'" />
              </li>
            </ul>
          </div>
        </div>

        <div class="head-slide on">
          Настройки
        </div>
        <div class="container">
          <ul class="editlist">
            <li>


            </li>
            <li>
              <label>Сортировать</label>

              <ul >
                <li>
                  <a href="/{$Controller}/exif-order/id/{$Main/@id}">по дате EXIF</a>
                </li>
                <li>
                  <a href="/{$Controller}/adddate-order/id/{$Main/@id}">по дате добавления </a>
                </li>





              </ul>
            </li>



           
          </ul>

        </div>


      </div>



      <div class="article">

        <xsl:choose>
          <xsl:when test="$arts = 1">
            <xsl:call-template name="Article-edit-switcher">
              <xsl:with-param name="active">2</xsl:with-param>
              <xsl:with-param name="arts">1</xsl:with-param>
            </xsl:call-template>
          </xsl:when>
          <xsl:when test="$files = 1">
            <xsl:call-template name="Article-edit-switcher">
              <xsl:with-param name="active">2</xsl:with-param>
              <xsl:with-param name="files">1</xsl:with-param>
            </xsl:call-template>
          </xsl:when>
          <xsl:otherwise>
            <xsl:call-template name="Article-edit-switcher">
              <xsl:with-param name="active">2</xsl:with-param>
            </xsl:call-template>
          </xsl:otherwise>

        </xsl:choose>



        <xsl:if test="not($Main/photos/row)">
          Нет фотографий, <a href="javascript:;" onclick="$('div.upload-window').prsfileupload('open');">загрузить</a>
        </xsl:if>



        <ul id="list_photo">
          <xsl:for-each select="$Main/photos/row">
            <li rel="{id}">
              <div>
                <img src="{$Files}{path}{id}list{file_name}" alt="" class="photolist"/>
                <!--
                <span class="name">
                  <a htef="/{$Controller}/editphoto/{id}" onclick="document.location = '/{$Controller}/editphoto/{id}'" style="cursor:pointer">
                    <xsl:value-of select="title"/>
                  </a>
                </span>
                
                <span class="date">
                  <xsl:call-template name="Write.Date.Time">
                    <xsl:with-param name="node" select="add_date"/>
                  </xsl:call-template>
                </span>
                <xsl:if test="exif_DateTime != ''">
                  <span class="date">
                    EXIF: <xsl:value-of select="exif_DateTime"/>
                  </span>
                </xsl:if>
                -->
                <span class="deletephoto">
                  <a href="javascript:;" onclick="list_func_remove({id})">
                    <img title="Удалить" alt="Удалить" src="/images/cross.png"/>
                  </a>
                  <br/>
                  <a href="/{$Controller}/editphoto/{id}">
                    <img title="Редактировать" alt="Редактировать" src="/images/picture_edit.png"/>
                  </a>
                  <br/>
                  <a href="javascript:;" onclick="cropPhoto({id}, $(this).parent().parent().find('img.photolist').width(),$(this).parent().parent().find('img.photolist').height())">
                    <img title="Вырезать" alt="Вырезать" src="/images/icons/image-crop.png"/>
                  </a>
                  <a onclick="return list_func_checkbox({id}, 'is_active');" href="javascript:;">
                    <input type="hidden" rel="is_active{id}" value="{is_active}"/>
                    <div style="display: none;" class="loaderis_active{id}">
                      <img title="Выполняется..." alt="Выполняется..." src="/images/loader.gif"/>
                    </div>
                    <div class="funcis_active{id}">
                      <div value="0" rel="is_active{id}" class="on">
                        <xsl:if test="is_active = 0">
                          <xsl:attribute name="style">
                            display: none
                          </xsl:attribute>
                        </xsl:if>
                        <img title="Активный" alt="Активный" src="/images/active.png"/>
                      </div>
                      <div value="1" rel="is_active{id}" class="off" style="display: none;">
                        <xsl:if test="is_active = 0">
                          <xsl:attribute name="style">
                            display: block
                          </xsl:attribute>
                        </xsl:if>
                        <img title="Не активный" alt="Не активный" src="/images/active_no.png"/>
                      </div>
                    </div>
                  </a>
                  
                
                 
                  <a onclick="return list_func_checkbox({id}, 'is_top');" href="javascript:;">
                    <input type="hidden" rel="is_top{id}" value="{is_top}"/>
                    <div style="display: none;" class="loaderis_top{id}">
                      <img title="Выполняется..." alt="Выполняется..." src="/images/loader.gif"/>
                    </div>
                    <div class="funcis_top{id}">
                      <div value="0" rel="is_top{id}" class="on">
                        <xsl:if test="is_top = 0">
                          <xsl:attribute name="style">
                            display: none
                          </xsl:attribute>
                        </xsl:if>
                        <img title="EN" alt="EN" src="/images/flag_green.png"/>
                      </div>
                      <div value="1" rel="is_top{id}" class="off" style="display: none;">
                        <xsl:if test="is_top = 0">
                          <xsl:attribute name="style">
                            display: block
                          </xsl:attribute>
                        </xsl:if>
                        <img title="RU" alt="RU" src="/images/flag_red.png"/>
                      </div>
                    </div>
                  </a>
                 
                </span>

              </div>
            </li>
          </xsl:for-each>
        </ul>

        <input name="list1SortOrder" type="hidden" />




      </div>
      <div class="submitbox">
        <input name="save" value="Сохранить" type="button" onclick="$('#form').submit();"/>
        <input name="saveexit" type="submit" value="Сохранить и выйти" />
        <input type="button" value="Отменить" onclick="document.location = '/{$Controller}/'"/>
      </div>
    </form>
  
</xsl:template>

<xsl:template name="Edit-Photos">
  <xsl:param name="arts"/>
     
  <script type="text/javascript" src="/js/tiny_mce/tiny_mce.js"></script>
  <script type="text/javascript" src="/js/tiny_mce/tiny_config_simple.js"></script>

  <div class="contenthead">

    <xsl:call-template name="Create_Path">
      <xsl:with-param name="last" select="$Main/@title"></xsl:with-param>
    </xsl:call-template>
    <div class="top">
      <span class="title">
        <xsl:value-of select="$Cats/row[id=$Content/@cat]/title" />
      </span>
    </div>

  </div>



  <form action="" method="post" name="form" id="form" enctype="multipart/form-data">
    <div class="aside">
      <xsl:call-template name="Box-Avatar" />
    </div>
    <div class="article">


      <xsl:choose>
        <xsl:when test="$arts = 1">
          <xsl:call-template name="Article-edit-switcher">
            <xsl:with-param name="active">2</xsl:with-param>
            <xsl:with-param name="arts">1</xsl:with-param>
          </xsl:call-template>
        </xsl:when>
        <xsl:otherwise>
          <xsl:call-template name="Article-edit-switcher">
            <xsl:with-param name="active">2</xsl:with-param>
          </xsl:call-template>
        </xsl:otherwise>

      </xsl:choose>
      <xsl:call-template name="Messages" />


      <input type="hidden" name="id" id="id" value="{$Form/id}" />

      <fieldset>
        <ul class="editlist">
          <li>
            <label>Заголовок</label>

            <input name="title" type="text" id="title" value="{Main/form/title}" size="70" class="broad100"/>
          </li>


          <li>
            <label>Описание</label>

            <textarea name="desc" id="body1" class="broad100">
              <xsl:value-of select="Main/form/desc"/>
            </textarea>
          </li>
          <li>
            <label>Аватар</label>
            <div>
              <input name="avatar" type="file" id="avatar" />
            </div>
          </li>
        </ul>
      </fieldset>

     



    </div>

    <div class="submitbox">
      <input name="save" value="Сохранить" type="button" onclick="$('#form').submit();"/>
      <input name="saveexit" type="submit" value="Сохранить и выйти" />
      <input type="button" value="Отменить" onclick="document.location = '/{$Controller}/photos/{$Main/@id}'"/>
    </div>
  </form>
  <script type="text/javascript" src="212.26.144.104:1204/js/tags_auto.js"></script>
</xsl:template>
  
</xsl:stylesheet>